package com.project.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.StudentBean;
import com.project.mapper.IStudentMapper;
import com.project.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StudentServiceImpl implements IStudentService {
    @Autowired
    private IStudentMapper studentMapper;

    @Override
    public void add(StudentBean student) {
        studentMapper.add(student);
    }

    @Override
    public void del(int id) {
        studentMapper.del(1);
    }

    @Override
    public void update(int id, String edu) {
        studentMapper.update(id,edu);
    }

    @Override
    public StudentBean findById(int id) {
        return studentMapper.findById(id);
    }

    @Override
    public PageInfo<StudentBean> cutAll(int pageNO) {
        PageHelper.startPage(pageNO,PAGE_SIZE);
        PageInfo<StudentBean> info = PageInfo.of(studentMapper.findAll());
        return info;
    }
}
